/*
 * @Author: Vorga
 * @LastEditors: Vorga
 */
#ifndef LINK_ARRAY_A_H
#define LINK_ARRAY_A_H

#include <stdio.h>
#include <stdbool.h>

#include "node.h"

typedef int (*CMP)(const void*,const void*);
typedef void (*FUNC)(const void*);

void add_head_lla(Node **headp,void *data);

void add_tail_lla(Node **headp,void *data);

void traversal_lla(Node* head,FUNC show);

bool _del_n_lla(Node** headp);

bool del_n_lla(Node** headp);

bool del_tail_lla(Node** headp);

bool del_index_lla(Node** headp,size_t index);

bool del_val_lla(Node** headp,void *val,CMP cmp);

bool del_uni_lla(Node** headp,CMP cmp);

Node** query_lla(Node **headp,void* key,CMP cmp);

void* access_last_index_lla(Node *head,size_t index);

Node* reverse_ll(Node* head);

void sort_ll(Node* head,CMP cmp);

Node* merge_ll(Node* head1,Node* head2,CMP cmp);

bool is_circle_ll(Node* head);

Node* get_circle_ll(Node* head);

Node* get_y_n_ll(Node* head1,Node* head2);

#endif // LINK_ARRAY_A_H
